﻿@model HdipCricketClub.ViewModels.PlayerMatchesViewModel

@{
    ViewBag.Title = "GetFixtures";
}

<h2>Matches played in by @Html.DisplayFor(ModelItem => Model.Player.FirstAndLastName):</h2>
    

<table>
    <tr>
        <th></th>
        <th></th>
        <th>
            Batting
        </th>
        <th></th>
        <th></th>
        <th>
            Bowling
        </th>
        <th></th>
    </tr>
    <tr>
        <th>
            Date:
        </th>
        <th>
            Opponent:
        </th>
        <th>
            Runs:
        </th>
        <th>
            Overs:
        </th>
        <th>
            Maidens:
        </th>
        <th>
            Runs:
        </th>
        <th>
            Wickets:
        </th>
    </tr>

@foreach (var item in Model.Matches) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Fixture.date)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Fixture.Opponent.club_name) @Html.DisplayFor(modelItem => item.Fixture.Opponent.team_name)
        </td>
        <td class="column_numbers">
            @Html.DisplayFor(modelItem => item.batting_runs)
        </td>
        <td class="column_numbers">
            @Html.DisplayFor(modelItem => item.overs)
        </td>
        <td class="column_numbers">
            @Html.DisplayFor(modelItem => item.maidens)
        </td>
        <td class="column_numbers">
            @Html.DisplayFor(modelItem => item.bowling_runs)
        </td>
        <td class="column_numbers">
            @Html.DisplayFor(modelItem => item.wickets)
        </td>
    </tr>
}
    <tr>
        <td>
            Total
        </td>
        <td></td>
        <td class="column_numbers">
            @ViewBag.TotalBattingRuns
        </td>
        <td class="column_numbers">
            @ViewBag.TotalOvers
        </td>
        <td class="column_numbers">
            @ViewBag.TotalMaidens
        </td>
        <td class="column_numbers">
            @ViewBag.TotalBowlingRuns
        </td>
        <td class="column_numbers">
            @ViewBag.TotalWickets
        </td>
    </tr>
</table>

<p>
    Batting Average = @ViewBag.BattingAverage<br />
    Bowling Average = @ViewBag.BowlingAverage
</p>

<p>
    @Html.ActionLink("View another player", "SeasonMatches", "Statistics")  |
    @Html.ActionLink("Return to Home Page", "Index","Home")
</p>


